package com.spboot.exts.entity.ajax;

import lombok.Data;

/**
 * 统一ajax返回结果
 * 
 * @author Administrator
 *
 */
@Data
public class AjaxJsonResult<T> {
	// 操作的成功
	private Boolean success;
	// 消息
	private String msg;

	private T data;

	public static <T>  AjaxJsonResult result(Boolean success, String msg, T data) {
		return new AjaxJsonResult(success, msg, data);
	}

	// 成功
	public static <T> AjaxJsonResult success(String msg, T data) {
		return new AjaxJsonResult(true, msg, data);
	}

	public static <T> AjaxJsonResult error(String msg, T data) {
		return new AjaxJsonResult(false, msg, data);
	}

	public AjaxJsonResult(Boolean success, String mag, T data) {
		super();
		this.success = success;
		this.msg = mag;
		this.data = data;
	}
}
